﻿using System.Collections.Generic;
using System.Linq;
using StudentInfo.Areas.StudentArea.ViewModels;
using StudentInfo.Areas.StudentArea.Services;

namespace StudentInfo.Areas.StudentArea.ViewModelHelpers
{
    public class MarkDetailsViewModelHelper
    {
        public static MarkDetailsViewModel PopulateMarkDetailsViewModel(Mark mark)
        {
            return new MarkDetailsViewModel
            {
                Id = mark.Id,
                StudentName = StudentService.Get(mark.StudentId).StudentName,
                ExamName = ExamService.Get(mark.ExamId).ExamName,
                Result = mark.Result
            };
        }

        public static List<MarkDetailsViewModel> PopulateMarkDetailsViewModelList(List<Mark> markList)
        {
            return markList.Select(s => PopulateMarkDetailsViewModel(s)).ToList();
        }
    }
}